package com.study.service;

import java.util.List;

import org.springframework.stereotype.Component;

import com.study.beans.User;

import feign.hystrix.FallbackFactory;

@Component
public class UserClientServiceFallbackFactory implements FallbackFactory<UserClientService> {

	@Override
	public UserClientService create(Throwable cause) {
		
		return new UserClientService() {
			
			@Override
			public List<User> list() {
				return null;
			}
			
			@Override
			public User get(Integer id) {
				return new User().setId(id).setName("未查询到信息，服务已关闭").setAddress("hehe,请稍后重试");
			}
			
			@Override
			public boolean add(User user) {
				return false;
			}
		};
	}

}
